
#include <stdio.h>
#include "sapi.h"


int main()
{
	ISpVoice *cpVoice;
    HRESULT hr;

	CoInitialize(NULL);
	hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&cpVoice);
	if (hr != S_OK)
    {
        return 1;
    }

	cpVoice->SetVolume(100); // [0, 100]
    cpVoice->SetRate(0);     // [-10, 10]

    hr = cpVoice->Speak(L"hello world.", SPF_ASYNC, 0);
	if (hr != S_OK)
    {
         return 2;
    }

    while (getchar() != 'q');

	cpVoice->Release();
	CoUninitialize();
	return 0;
}

